feat(core): Claude Code lessons — instruction file exclusion + explicit dangerous preset - #186
Open
raymondginger2018-sudo wants to merge 1 commit into
Open
Conversation
…it dangerous preset
借鉴 Claude Code 两处机制 (2026-08-19):
1. core/harness/memory.py — 指令文件排除模式
- DEEPCODE_INSTRUCTION_EXCLUDES env: 逗号分隔 glob (如 **/code/CLAUDE.md,**/vendor/**)
- 命中的 AGENTS.md/DEEPCODE.md/CLAUDE.md 跳过注入, 避免 monorepo 子目录/
第三方代码指令污染主提示词
- 自实现 glob→regex: ** 匹配任意层级(可选前缀 (?:.*/)?), * / ? 不跨路径
分隔符; vendorized ≠ vendor/ 前缀同名不误匹配
- 非法模式忽略不阻断加载
2. core/domain/execution_security.py — 显式危险预设
- ExecutionAccessPreset.DANGEROUS_SKIP="dangerous_skip", 对齐 Claude Code
--allow-dangerously-skip-permissions; 与 FULL_ACCESS 同强度但名字自带
危险警示, 供日志/UI 明确区分
3. tests/test_memory.py — 4 个新用例 (glob 正反例/集成/非法模式)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
借鉴 Claude Code 两处机制落地 (2026-08-19)
1. core/harness/memory.py — 指令文件排除模式
DEEPCODE_INSTRUCTION_EXCLUDES环境变量: 逗号分隔 glob 模式 (如**/code/CLAUDE.md,**/vendor/**)**匹配任意层级 (可选前缀(?:.*/)?),*/?不跨路径分隔符; 前缀同名目录 (vendorized ≠ vendor/) 不误匹配2. core/domain/execution_security.py — 显式危险预设
ExecutionAccessPreset.DANGEROUS_SKIP = "dangerous_skip", 对齐 Claude Code--allow-dangerously-skip-permissions3. tests/test_memory.py — 4 个新用例
验证